package singleton.simple;

/**
 * @Author： yu.Tan
 * @Date: 2020/10/9 9:59
 * @Description:
 */
public class SingletonPatternDemo {
    public static void main(String[] args) {
        //不合法的构造函数
        //编译时错误：构造函数 SingleObject() 是不可见的
        //SingleObject object = new SingleObject();

        SingleObject singleObject = SingleObject.getInstance();

        //显示消息
        singleObject.showMessage();

        SingleObject singleObject1 = SingleObject.getInstance();

        System.out.println(singleObject.hashCode() == singleObject1.hashCode());
    }
}
